/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.tomasio.projects.welcome;


import com.tomasio.projects.welcome.dao.ChaveDAO;
import com.tomasio.projects.welcome.dao.DAOFactory;
import com.tomasio.projects.welcome.dto.ChaveDTO;
import com.tomasio.projects.welcome.interfaces.ClavicularioService;

import com.tomasio.projects.welcome.util.DAOUtil;
import java.util.List;

/**
 *
 * @author administrador
 */
public class SimpleClavicularioService implements ClavicularioService {

    private DAOFactory factory = DAOUtil.getDAOFactory();

    @Override
    public void createChave(ChaveDTO chave) {
        ChaveDAO dao = factory.getChaveDAO();
        dao.create(chave);
    }

    @Override
    public void removeChave(Long chaveId) {
        ChaveDAO dao = factory.getChaveDAO();
        dao.remove(chaveId);
    }

    @Override
    public ChaveDTO findChave(Long chaveId) {
        ChaveDAO dao = factory.getChaveDAO();
        return dao.find(chaveId);
    }

    @Override
    public ChaveDTO findChaveByNumero(String numero) {
        ChaveDAO dao = factory.getChaveDAO();
        return dao.findByNumero(numero);
    }

    @Override
    public List<ChaveDTO> findAllChaves() {
        ChaveDAO dao = factory.getChaveDAO();
        return dao.findAll();
    }

    @Override
    public void updateChave(ChaveDTO chave) {
        ChaveDAO dao = factory.getChaveDAO();
        dao.update(chave);
    }
}
